<!DOCTYPE html>
<html xmlns=http://www.w3.org/1999/xhtml xmlns:bd=http://www.baidu.com/2010/xbdml>
<head>

    <title>角色列表</title>
    <meta http-equiv="Content-Type" content="text/html" charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link Rel="SHORTCUT ICON" href="/pc/login/img/logo1.png">
    <link rel="stylesheet" href="/pc/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/font_eolqem241z66flxr.css" media="all" />
    <link rel="stylesheet" href="/pc/layout/css/news.css" media="all" />
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote news_search">
    <div class="layui-inline">
        <div class="layui-input-inline" style="margin-top: 5px;">            
           <label class="layui-form-label" style="padding: 0;width: 66px;margin-top: 1px;height: 36.4px;background: #e4dede;text-align: center;line-height: 36.4px;">代理商</label>
            <select name="city" lay-verify="" class="layui-input search_input"  style="width: 11em">
                <option value="">请选择代理商</option>
                <option value="010">1</option>
                <option value="021">2</option>
                <option value="0571">3</option>
            </select> 
        </div>
          <div class="layui-input-inline" style="margin-top: 5px; margin-left: 30px;">
        <a class="layui-btn search_btn" style="margin-top: 5px;">查询</a>
         <a class="layui-btn linksAdd_btn" style="background-color:#5FB878;margin-top: 5px;">添加</a>
        </div>
    </div>
</blockquote>
<div class="layui-form links_list">
    <table class="layui-table">
      {{ csrf_field() }}
        <thead>
        <tr>
            <th >编号</th>
            <th>角色名称</th>          
            <th style="width: 40%">操作</th>            
        </tr>
        </thead>
        <tbody class="links_content">
            @if(!empty($data))
                @foreach($data as $val)
                    <tr id="role_{{$val['id']}}">             
                        <td>{{$val['id']}}</td>
                         <td>{{$val['name']}}</td>
                        <td>
                        @if($val['auth_ids'] !== '0')
                            <a class="layui-btn layui-btn-danger layui-btn-mini link_aut" role="{{$val['id']}}" style="background-color: #5FB878"><img src="/pc/role/img/qx.png" alt="" style="margin-top: -3px; width:13px;" /> 权限</a>
                        @endif
                        @if($val['auth_ids'] !== '0')
                            <a class="layui-btn layui-btn-danger layui-btn-mini link_adm" role="{{$val['id']}}" style="background-color: #1E9FFF"><img src="/pc/role/img/adm.png" alt="" style="margin-top: -3px; width:13px;" /> 管理</a>
                        @endif
                            <a class="layui-btn layui-btn-mini links_edit" role="{{$val['id']}}"><i class="iconfont icon-edit"></i> 编辑</a>
                        @if($val['auth_ids'] !== '0')
                            <a class="layui-btn layui-btn-danger layui-btn-mini links_del" onclick="delRole({{$val['id']}})" data-id="1"><i class="layui-icon"></i> 删除</a>
                        @endif
                        </td>
                    </tr>
                @endforeach
            @endif
        </tbody>
    </table>
</div>
@if(!null == $data)
    <div style="float:right;">
        {!! $data->appends($request)->render() !!}
    </div>
@endif
<script type="text/javascript" src="/pc/layout/js/jquery.min.js"></script>
<script type="text/javascript" src="/pc/layui/layui.js"></script>
<script type="text/javascript" src="/pc/role/js/role.js"></script>
<script>
         function delRole(id){  //删除
        layer.confirm('确定删除此信息？',{icon:3, title:'提示信息'},function(index){
            $.ajax({
                url:'/admin/role/destroy',
                type:'post',
                async:false,
                data:{
                    "_token": $("input[name=_token]").val(),
                    'id':id
                },
                dataType:'json',
                success:function (data) {
                    if(data.status == 1){
                        $('#role_'+id).remove();
                        layer.msg('删除成功！',{time:800});
                         layer.close(index);
                    }
                }
            })
            layer.close(index);
        });
    }
</script>
</body>
</html>